package com.eastfair.venuebooking.service.impl;

import com.eastfair.common.api.PaymentRecordFeign;
import com.eastfair.core.base.R;
import com.eastfair.core.exception.BizException;
import com.eastfair.pay.dto.PaymentRecordDTO;
import com.eastfair.pay.vo.PaymentRecordVO;
import com.eastfair.venuebooking.service.VenueBookingPaymentRecordService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 支付系统付款记录 service.
 *
 * @author dqq
 * @date 2022 /6/25
 */
@Service
@Slf4j
public class VenueBookingPaymentRecordServiceImpl implements VenueBookingPaymentRecordService {

    @Resource
    private PaymentRecordFeign paymentRecordFeign;

    @Override
    public List<PaymentRecordVO> listPaymentRecordVOs(PaymentRecordDTO paymentRecordDTO) {

        R<List<PaymentRecordVO>> result = paymentRecordFeign.queryList(paymentRecordDTO);
        if (!result.getIsSuccess()) {
            throw BizException.wrap(result.getCode(), result.getMsg());
        }
        return result.getData();
    }
}
